package com.genexususa.eo.bing.test.update;

import com.genexususa.eo.bing.connection.KeywordManager;
import com.genexususa.eo.bing.test.TestUtil;

public class ConsumeUpdateKeywords {
    public static void main(String[] args) {
        TestUtil testUtil = new TestUtil();
        String keywordsRequestsXML =    "<Bing_KeywordsRequestCollection xmlns=\"L2TMediaDev\">\n" +
                                            "\t<Bing_KeywordsRequest xmlns=\"L2TMediaDev\">\n" +
                                                "\t\t<GxCampaignId>45616011</GxCampaignId>\n" +
                                                "\t\t<BingCampaignId>" + testUtil.campaignId1 + "</BingCampaignId>\n" +
                                                "\t\t<KeywordsAdGroupRequestCollection>\n" +
                                                    "\t\t\t<KeywordsAdGroupRequest>\n" +
                                                        "\t\t\t\t<GxAdGroupId>452315612</GxAdGroupId>\n" +
                                                        "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup11 + "</BingAdGroupId>\n" +
                                                        "\t\t\t\t<KeywordCollection>\n" +
                                                            "\t\t\t\t\t<Keyword>\n" +
                                                                "\t\t\t\t\t\t<ContentMatchBid xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                    "\t\t\t\t\t\t\t<Amount>620</Amount>\n" +
                                                                "\t\t\t\t\t\t</ContentMatchBid>\n" +
                                                                "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891652</GxKeywordId>\n" +
                                                                "\t\t\t\t\t\t<BingKeywordId>" + testUtil.keywordId111 + "</BingKeywordId>\n" +
                                                                "\t\t\t\t\t\t<NegativeKeywordCollection xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                    "\t\t\t\t\t\t\t<NegativeKeyword>newneg</NegativeKeyword>\n" +
                                                                "\t\t\t\t\t\t</NegativeKeywordCollection>\n" +
                                                                "\t\t\t\t\t\t<Param1 xmlns=\"https://adcenter.microsoft.com/v8\">newparam1</Param1>\n" +
                                                            "\t\t\t\t\t</Keyword>\n" +
                                                            "\t\t\t\t\t<Keyword>\n" +
                                                                "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891653</GxKeywordId>\n" +
                                                                "\t\t\t\t\t\t<BingKeywordId>" + testUtil.keywordId112 + "</BingKeywordId>\n" +
                                                                "\t\t\t\t\t\t<Param1 xmlns=\"https://adcenter.microsoft.com/v8\">newparam12</Param1>\n" +
                                                                "\t\t\t\t\t\t<Param2 xmlns=\"https://adcenter.microsoft.com/v8\">newparam22</Param2>\n" +
                                                                "\t\t\t\t\t\t<Param3 xmlns=\"https://adcenter.microsoft.com/v8\">newparam32</Param3>\n" +
                                                            "\t\t\t\t\t</Keyword>\n" +
                                                        "\t\t\t\t</KeywordCollection>\n" +
                                                    "\t\t\t</KeywordsAdGroupRequest>\n" +
                                                "\t\t</KeywordsAdGroupRequestCollection>\n" +
                                            "\t</Bing_KeywordsRequest>\n" +
                                            "\t<Bing_KeywordsRequest xmlns=\"L2TMediaDev\">\n" +
                                                "\t\t<GxCampaignId>45616012</GxCampaignId>\n" +
                                                "\t\t<BingCampaignId>" + testUtil.campaignId2 + "</BingCampaignId>\n" +
                                                "\t\t<KeywordsAdGroupRequestCollection>\n" +
                                                    "\t\t\t<KeywordsAdGroupRequest>\n" +
                                                        "\t\t\t\t<GxAdGroupId>452315613</GxAdGroupId>\n" +
                                                        "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup21 + "</BingAdGroupId>\n" +
                                                        "\t\t\t\t<KeywordCollection>\n" +
                                                            "\t\t\t\t\t<Keyword>\n" +
                                                                "\t\t\t\t\t\t<ContentMatchBid xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                    "\t\t\t\t\t\t\t<Amount>54.32</Amount>\n" +
                                                                "\t\t\t\t\t\t</ContentMatchBid>\n" +
                                                                "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891652</GxKeywordId>\n" +
                                                                "\t\t\t\t\t\t<BingKeywordId>" + testUtil.keywordId211 + "</BingKeywordId>\n" +
                                                                "\t\t\t\t\t\t<NegativeKeywordCollection xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                                                    "\t\t\t\t\t\t\t<NegativeKeyword>newnegative13</NegativeKeyword>\n" +
                                                                    "\t\t\t\t\t\t\t<NegativeKeyword>newnegative23</NegativeKeyword>\n" +
                                                                "\t\t\t\t\t\t</NegativeKeywordCollection>\n" +
                                                            "\t\t\t\t\t</Keyword>\n" +
                                                        "\t\t\t\t</KeywordCollection>\n" +
                                                    "\t\t\t</KeywordsAdGroupRequest>\n" +
                                                    "\t\t\t<KeywordsAdGroupRequest>\n" +
                                                        "\t\t\t\t<GxAdGroupId>452315614</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup22 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<KeywordCollection>\n" +
                                                            "\t\t\t\t\t<Keyword>\n" +
                                                                "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891653</GxKeywordId>\n" +
                                                                "\t\t\t\t\t\t<BingKeywordId>" + testUtil.keywordId221 + "</BingKeywordId>\n" +
                                                                "\t\t\t\t\t\t<Param2 xmlns=\"https://adcenter.microsoft.com/v8\">newparam24</Param2>\n" +
                                                                "\t\t\t\t\t\t<Param3 xmlns=\"https://adcenter.microsoft.com/v8\">newparam34</Param3>\n" +
                                                            "\t\t\t\t\t</Keyword>\n" +
                                                        "\t\t\t\t</KeywordCollection>\n" +
                                                    "\t\t\t</KeywordsAdGroupRequest>\n" +
                                                "\t\t</KeywordsAdGroupRequestCollection>\n" +
                                            "\t</Bing_KeywordsRequest>\n" +
                                        "</Bing_KeywordsRequestCollection>\n";
        KeywordManager resource = new KeywordManager();
        System.out.println("Consuming UpdateKeywords.....");
        String userName = testUtil.userName;
        String password = testUtil.password;
        String developerToken = testUtil.developerToken;
        long customerId = testUtil.customerId;
        long customerAccountId = testUtil.customerAccountId;
        String applicationId = testUtil.applicationId;
        String result = resource.updateKeywords(customerAccountId, keywordsRequestsXML);
        System.out.println("Result:\n" + result);
    }
}
